package com.motong.gongdan.vo.H5Resp;

import com.motong.gongdan.constant.ColumnTypeIconMap;
import com.motong.gongdan.enums.ObjectType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * 移动端卡片设置
 */
@Data
public class H5MobileCardConfResp implements Serializable {

    /**
     * 中文名称
     */
    @ApiModelProperty(value = "中文名称")
    private String cnName;

    /**
     * 英文名称
     */
    @ApiModelProperty(value = "英文名称")
    private String enName;


    /**
     * 类型(0 标题, 1 元素, 2 封面)
     */
    @ApiModelProperty(value = "类型(0 标题, 1 元素, 2 封面)")
    private Integer type;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    private Integer sort;

    /**
     * 所属模块
     */
    @ApiModelProperty(value = "所属模块")
    private String columnModule;

    /**
     * 图标名称
     */
    @ApiModelProperty(value = "图标名称")
    private String iconName;

    @ApiModelProperty(value = "属性类型", hidden = true)
    private String customColumnType;

    public void setCustomColumnType(String customColumnType) {
        this.customColumnType = customColumnType;
        if (StringUtils.hasLength(customColumnType)){
            this.iconName = new ColumnTypeIconMap().getIconByName(ObjectType.workOrder.getCode(), customColumnType);
        }
    }


    private static final long serialVersionUID = 1L;
}